<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Projet Jetpack:  Fichier source de /home/p1006250/lif7-projet-jetpack/src/Jeu.c</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Projet Jetpack
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Généré par Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Page&#160;principale</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
      <li><a href="dirs.html"><span>Répertoires</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Liste&#160;des&#160;fichiers</span></a></li>
      <li><a href="globals.html"><span>Membres&#160;de&#160;fichier</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_jeu_8c.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">Jeu.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_jeu_8c.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &quot;<a class="code" href="_jeu_8h.html">Jeu.h</a>&quot;</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 
<a name="l00004"></a><a class="code" href="_jeu_8h.html#adea2de1f9bb9c58341d64db6e20261cc">00004</a> <span class="keywordtype">void</span> <a class="code" href="_jeu_8c.html#adea2de1f9bb9c58341d64db6e20261cc" title=" Brief Description  initialise le jeu.  ">jeuInit</a>(<a class="code" href="struct_jeu.html">Jeu</a> * pJeu)
<a name="l00005"></a>00005 {
<a name="l00006"></a>00006     <a class="code" href="_personnage_8c.html#a21494e4333106a3def7e217cf6402be7" title=" Brief Description  Initialise le personnage.  ">perInit</a>(&amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a6f7d16644f0e9c2a79d409e299060e03">Per</a>));
<a name="l00007"></a>00007     <a class="code" href="_terrain_8c.html#aa3b3da7033de7e4286324e724ec4eaed" title=" Brief Description  initialise le terrain.  ">terInit</a>(&amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a4df9d34c4af649dd172c2c7f9c1e8ffd">Ter</a>), &amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a263d537113ffd18d7a62b8554b634801">Tersuiv</a>));
<a name="l00008"></a>00008     <a class="code" href="_score_8c.html#aa9b64bf47785778438e880367c2ec66c" title=" Brief Description  Initialise le score.  ">scoreInit</a>(pJeu-&gt;<a class="code" href="struct_jeu.html#a53944514a19f727f5e26a8edb69a1749">Score</a>);
<a name="l00009"></a>00009 }
<a name="l00010"></a>00010 
<a name="l00011"></a><a class="code" href="_jeu_8c.html#a7490df14d33262154bbe83113c17700a">00011</a> <span class="keyword">const</span> <a class="code" href="structs_terrain.html">Terrain</a> *<a class="code" href="_jeu_8c.html#a7490df14d33262154bbe83113c17700a">getTerrain</a>(<span class="keyword">const</span> <a class="code" href="struct_jeu.html">Jeu</a> *pJeu)
<a name="l00012"></a>00012 {
<a name="l00013"></a>00013         <span class="keywordflow">return</span> (&amp;pJeu-&gt;<a class="code" href="struct_jeu.html#a4df9d34c4af649dd172c2c7f9c1e8ffd">Ter</a>);
<a name="l00014"></a>00014 }
<a name="l00015"></a>00015 
<a name="l00016"></a><a class="code" href="_jeu_8h.html#a786f233e989952b6d82bc3a7fa87d2b2">00016</a> <span class="keyword">const</span> <a class="code" href="struct_personnage.html">Personnage</a> *<a class="code" href="_jeu_8c.html#a786f233e989952b6d82bc3a7fa87d2b2" title=" Brief Description  Accesseur.   ">getPerso</a>(<span class="keyword">const</span> <a class="code" href="struct_jeu.html">Jeu</a> *pJeu)
<a name="l00017"></a>00017 {
<a name="l00018"></a>00018         <span class="keywordflow">return</span> (&amp;pJeu-&gt;<a class="code" href="struct_jeu.html#a6f7d16644f0e9c2a79d409e299060e03">Per</a>);
<a name="l00019"></a>00019 }
<a name="l00020"></a>00020 
<a name="l00021"></a><a class="code" href="_jeu_8h.html#adb65ee0313193cafff506c8029340660">00021</a> <span class="keywordtype">void</span> <a class="code" href="_jeu_8c.html#adb65ee0313193cafff506c8029340660" title=" Brief Description  Récupère l&#39;action du clavier.   ">actionClavier</a>(<a class="code" href="struct_jeu.html">Jeu</a> *pJeu, <span class="keywordtype">char</span> touche)
<a name="l00022"></a>00022 {
<a name="l00023"></a>00023         <span class="keywordflow">switch</span>(touche)
<a name="l00024"></a>00024         {
<a name="l00025"></a>00025 
<a name="l00026"></a>00026                 <span class="keywordflow">case</span> <span class="charliteral">&#39;h&#39;</span> :
<a name="l00027"></a>00027                                 <a class="code" href="_personnage_8c.html#a408d2cc39535b0a92024a90926ca4271" title=" Brief Description  .  ">persMonter</a>(&amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a6f7d16644f0e9c2a79d409e299060e03">Per</a>), &amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a4df9d34c4af649dd172c2c7f9c1e8ffd">Ter</a>));
<a name="l00028"></a>00028                                 <span class="keywordflow">break</span>;
<a name="l00029"></a>00029                 <span class="keywordflow">case</span> <span class="charliteral">&#39;b&#39;</span> :
<a name="l00030"></a>00030                                 <a class="code" href="_personnage_8c.html#a6a490c36627581465ab122dcfdfc7256" title=" Brief Description  .  ">persDescendre</a>(&amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a6f7d16644f0e9c2a79d409e299060e03">Per</a>), &amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a4df9d34c4af649dd172c2c7f9c1e8ffd">Ter</a>));
<a name="l00031"></a>00031                                 <span class="keywordflow">break</span>;
<a name="l00032"></a>00032                 <span class="keywordflow">case</span> <span class="charliteral">&#39;d&#39;</span> :
<a name="l00033"></a>00033                                 <a class="code" href="_personnage_8c.html#a004af9f2264e199834bee9cdcc4972ee" title=" Brief Description  Fait avancer le personnage .  ">persAvance</a>(&amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a6f7d16644f0e9c2a79d409e299060e03">Per</a>), &amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a4df9d34c4af649dd172c2c7f9c1e8ffd">Ter</a>));
<a name="l00034"></a>00034                                 <span class="keywordflow">break</span>;
<a name="l00035"></a>00035                 <span class="keywordflow">case</span> <span class="charliteral">&#39;g&#39;</span> :
<a name="l00036"></a>00036                                 <a class="code" href="_personnage_8c.html#a77f229fc53c33edc2fb79172037ca3c4" title=" Brief Description  Fait reculer le personnage .  ">persRecule</a>(&amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a6f7d16644f0e9c2a79d409e299060e03">Per</a>), &amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a4df9d34c4af649dd172c2c7f9c1e8ffd">Ter</a>));
<a name="l00037"></a>00037                                 <span class="keywordflow">break</span>;
<a name="l00038"></a>00038         }
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="_jeu_8h.html#a2ec855d639ca287ad8278b8baf49d677">00041</a> <span class="keywordtype">void</span> <a class="code" href="_jeu_8c.html#a2ec855d639ca287ad8278b8baf49d677" title=" Brief Description  Libère la mémoire allouée.   ">jeuLibere</a>(<a class="code" href="struct_jeu.html">Jeu</a> *pJeu)
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043         <a class="code" href="_personnage_8c.html#a0150dff37c6468d9743c84b16d085881" title=" Brief Description  Libère la mémoire allouée.  ">perLibere</a>(&amp;(pJeu-&gt;<a class="code" href="struct_jeu.html#a6f7d16644f0e9c2a79d409e299060e03">Per</a>));
<a name="l00044"></a>00044 }
<a name="l00045"></a>00045 
<a name="l00046"></a><a class="code" href="_jeu_8h.html#ad235b917e73fcf39f4c432ef70a4e7e1">00046</a> <span class="keywordtype">int</span> <a class="code" href="_jeu_8c.html#ad235b917e73fcf39f4c432ef70a4e7e1">divEuclidienne</a>(<span class="keywordtype">int</span> a, <span class="keywordtype">int</span> b)
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048     assert(b!=0);
<a name="l00049"></a>00049     <span class="keywordflow">if</span>(a&gt;0)
<a name="l00050"></a>00050         <span class="keywordflow">return</span>((a-(a%b))/b);
<a name="l00051"></a>00051     <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0;
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 
<a name="l00055"></a><a class="code" href="_jeu_8h.html#a352bd60c0d6e3d2d0293fde191b26b21">00055</a> <span class="keywordtype">void</span> <a class="code" href="_jeu_8c.html#a352bd60c0d6e3d2d0293fde191b26b21" title=" Brief Description  Evolution du jeu.   ">jeuEvolue</a>(<a class="code" href="struct_jeu.html">Jeu</a> *pJeu)
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057             <span class="keywordtype">int</span> acc, vitessex;
<a name="l00058"></a>00058             acc=<a class="code" href="_jeu_8c.html#ad235b917e73fcf39f4c432ef70a4e7e1">divEuclidienne</a>(pJeu-&gt;<a class="code" href="struct_jeu.html#a4df9d34c4af649dd172c2c7f9c1e8ffd">Ter</a>.<a class="code" href="structs_terrain.html#a5692b40e1e9677764b6da00a4c2c24e9">xscroll</a>,5000);
<a name="l00059"></a>00059             <span class="keywordflow">if</span>(acc&gt;=1)
<a name="l00060"></a>00060             {
<a name="l00061"></a>00061                 vitessex=acc+1;
<a name="l00062"></a>00062             }
<a name="l00063"></a>00063             <span class="keywordflow">else</span> vitessex=1;
<a name="l00064"></a>00064             pJeu-&gt;<a class="code" href="struct_jeu.html#a2a5b02bb12426e286475b057b44a6a12">vy</a> = 0;
<a name="l00065"></a>00065             pJeu-&gt;<a class="code" href="struct_jeu.html#af0658fc8d5710420a9e3d2704003178d">vx</a> = vitessex;
<a name="l00066"></a>00066 }
<a name="l00067"></a>00067 
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_jeu_8c.html">Jeu.c</a>      </li>

    <li class="footer">Généré le Lundi Décembre 17 2012 01:09:40 pour Projet Jetpack par
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
